package com.example.hengjun.operation_oracle.mapper;


import com.example.hengjun.operation_oracle.entity.Testuser;
import org.apache.ibatis.annotations.*;


//这里可以不使用注解，在启动类中加上MapperScan注解，里面添加该mapper所在的包路径即可
public interface UserMapper {

    //使用注解式开发查询语句

    //增
    @Insert("INSERT INTO TESTUSER(ID,NAME, AGE) VALUES(#{id}, #{name},#{age})")
    int addUser(Integer id, String name, Integer age);

    //删
    @Delete("DELETE FROM TESTUSER WHERE ID =#{id}")
    int deleteUser( Integer id);

    //查
    @Select("SELECT * FROM TESTUSER WHERE NAME = #{name}")
    Testuser findByName(String name);

    //改
    @Update("UPDATE TESTUSER SET NAME = #{name},AGE = #{age} WHERE ID=#{id} ")
    int updape(Integer id, String name, Integer age);
}